﻿using System;
using UtilZ.Dotnet.Ex.Config;

namespace ConAppCore.Test
{
    internal class TestAppConfigurationManager
    {
        public static void Test()
        {
            //System.Configuration.Configuration conf = System.Configuration.ConfigurationManager.OpenExeConfiguration("");
            //System.Configuration.AppSettingsSection section = conf.AppSettings;

            //System.Configuration.ConfigurationManager.AppSettings

            //AppConfigurationManager

            AppConfiguration xx = AppConfigurationManager.Load();

            var v0 = xx.AppSettings["string"];

            var ret1 = xx.TryGetValue<bool>("bool", out var v1);
            var ret2 = xx.TryGetValue<string>("string", out var v2);

            var ret3 = xx.TryGetValue<sbyte>("sbyte", out var v3);
            var ret4 = xx.TryGetValue<byte>("byte", out var v4);

            var ret5 = xx.TryGetValue<short>("short", out var v5);
            var ret6 = xx.TryGetValue<ushort>("ushort", out var v6);

            var ret7 = xx.TryGetValue<int>("int", out var v7);
            var ret8 = xx.TryGetValue<uint>("uint", out var v8);

            var ret9 = xx.TryGetValue<long>("long", out var v9);
            var ret10 = xx.TryGetValue<ulong>("ulong", out var v10);

            var ret11 = xx.TryGetValue<float>("float", out var v11);
            var ret12 = xx.TryGetValue<double>("double", out var v12);

            var ret13 = xx.GetValue<decimal>("decimal", 132.0M);
            var ret14 = xx.TryGetValue<DateTime>("abc", out var v13);
        }
    }
}
